﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Asteroids
{
    public class Explosion : SpaceItem
    {
        protected bool m_doneAnimating;

        public bool doneAnimating
        {
            get { return m_doneAnimating; }
        }

        public Explosion(int mod, Vector2 pos, Vector2 vel)
            : base(pos, vel) 
        {
            //Yes, 64 frames is correct.
            m_sprite = new AnimatedSprite(Game1.explosionTypes[mod].texture, 0, 0, 64, 64, 64);
            m_doneAnimating = false;
            centerPosition = pos;
        }

        public override void Update(GameTime gametime)
        {
            //Check if doneAnimating first, since if it is true at this point then the last frame has already been drawn.
            if (m_sprite.currentFrame == m_sprite.frameCount - 1)
            {
                m_doneAnimating = true;
            }
            base.Update(gametime);
        }
    }
}
